<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <input type="text" id="name" value="张三" /><br />
    <script>
      var nameComp = document.getElementById('name')
      //1. 获得 value属性  .value
      console.log('value属性.value:' + nameComp.value)
      //2. 获得 通过 getAt
      console.log(
        'value属性.getAttribute("value"):' + nameComp.getAttribute('value')
      )

      //赋值
      //nameComp.value = '张三疯'
      nameComp.setAttribute('value', '张三疯2')
    </script>
  </body>
</html>
